package org.wzl.service.convert;

import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.wzl.service.vo.UserInfoVO;
import org.wzl.service._do.UserInfo;
import org.wzl.service._do.UserLogin;
import org.wzl.service.bo.redis.RedisUserBO;
import org.wzl.service.dto.UserLoginDTO;
import org.wzl.service.dto.UserRegisterDTO;

@Mapper(componentModel = "spring")
public interface UserMapperStruct {

    UserLogin getDo(UserRegisterDTO userRegisterDTO);

    UserLogin getDo(UserLoginDTO userLoginDTO);

    UserInfo getInfoDo(UserRegisterDTO userRegisterDTO);

    @Mappings({
            @Mapping(source = "redisUserBO.userInfo.id", target = "id"),
            @Mapping(source = "redisUserBO.userInfo.nickname", target = "nickname"),
            @Mapping(source = "redisUserBO.userInfo.sex", target = "sex"),
            @Mapping(source = "redisUserBO.userLogin.email", target = "email"),
            @Mapping(source = "redisUserBO.userInfo.createDate", target = "createDate")
    })
    UserInfoVO getVO(RedisUserBO redisUserBO);
}
